import Vue from 'vue'
import VueRouter from 'vue-router'
import Film from '../components/Film.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/film',
    name: 'Film',
    component: Film,
    children: [
      {
        path: 'pagefirst',
        name: 'PageFirst',
        component: () => import('../components/films/PageFirst'),//路由懒加载
      },
      {
        path: '/film/pagesecond',
        name: 'PageSecond',
        component: () => import('../components/films/PageSecond'),//路由懒加载
      },
      {
        path: '',
        redirect: '/film/pagefirst'
      }
    ]
  },
  {
    path: '/cinema',
    name: 'Cinema',
    component: () => import('../components/Cinema'),//路由懒加载
  },
  {
    path:'/cinema/cityname',
    name: 'CityName',
    component: () => import('../components/cinema/CityName'),//路由懒加载
  },
  {
    path: '/infor',
    name: 'Infor',
    component: () => import('../components/Infor'),//路由懒加载
  }, {
    path: '/mine',
    name: 'Mine',
    component: () => import('../components/Mine'),//路由懒加载
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('../components/Search'),//路由懒加载
  },
  //Query方式路由
  // {
  //   path: '/detail',
  //   name: 'Detail',
  //   component: () => import('../components/Detail'),//路由懒加载
  // },
  {
    path: '/detail/:id',
    name: 'Detail',
    component: () => import('../components/Detail'),//路由懒加载
  },
  {
    path: '/',
    redirect: '/film'
  },
  {
    path: '*',
    redirect: '/film'
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
